home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 113 / 113.d81 / lsps source.pal (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  26KB  |  895 lines

  1. 10 open 1,8,1,"0:object,p"
  2. 20 open 4,4
  3. 30 sys700
  4. 40 *=$0801 ;basic load address!
  5. 50 .opt n,p4,o1
  6. 60 ;**********************************
  7. 70 ;*
  8. 80 ;* copyright 1986,87,88,89,90,91,92
  9. 90 ;* by gre(NULL)ry robert schiedler
  10. 100 ;* 12906 downs road ne
  11. 110 ;* mount angel, or 97362
  12. 120 ;* (503)845-2802  (503)845-6821
  13. 130 ;* all rights reverved...
  14. 140 ;*
  15. 150 ;*********************************
  16. 160 ;      definitions/equates for
  17. 170 ;      external label references
  18. 180 ;
  19. 190 fretop = $33
  20. 200 msgflg = $9d
  21. 210 mask01 = $9e
  22. 220 mask02 = $9f
  23. 230 tape1 = $b2
  24. 240 lstx = $c5
  25. 250 ;
  26. 260 ;free zero page user locations
  27. 270 ;
  28. 280 usr01 = $fb
  29. 290 usr02 = $fc
  30. 300 usr03 = $fd
  31. 310 usr04 = $fe
  32. 320 ;
  33. 330 ;disk name & id byte locations
  34. 340 ;
  35. 350 diskname =$0807
  36. 360 id01 = $0819
  37. 370 id02 = $081a
  38. 380 ;
  39. 390 buff1c00 = $1c00 ;name string under graphics
  40. 400 namebuff = $1f00 ;current name for load
  41. 410 moveit = $a3bf ;basic subroutine to move code
  42. 420 ;
  43. 430 ;screen color pokes
  44. 440 ;
  45. 450 border = $d020
  46. 460 bkgrnd = $d021
  47. 470 ;
  48. 480 ;kernal subroutine calls
  49. 490 ;
  50. 500 setmsg = $ff90 ;control kernal messages
  51. 510 setlfs = $ffba ;set locical 1st & 2nd address
  52. 520 setnam = $ffbd ;set file name
  53. 530 open = $ffc0   ;open a logical file
  54. 540 chkout = $ffc9 ;open a channel for output
  55. 550 chrout = $ffd2 ;output a character a-reg
  56. 560 load = $ffd5   ;load ram from device
  57. 570 clall = $ffe7  ;close all files and channels
  58. 580 ;
  59. 590 ;---------------------------------
  60. 600 onlyml _ 1 ;set to 1 or 0
  61. 610 ;---------------------------------
  62. 620 ; set to 1 to assemble only the
  63. 630 ; code @ $8000 pure m/l
  64. 640 ; set to 0 to assemble the basic
  65. 650 ; loader & the m/l @ $8000
  66. 660 ; note!!! you must then load the
  67. 670 ; object with a monitor and remove
  68. 680 ; all the junk bytes the assembler
  69. 690 ; padded into the object file...
  70. 700 ;---------------------------------
  71. 710 ;
  72. 720 *=$0801 ;original p/c
  73. 730 ;
  74. 740 .if onlyml:.goto1040
  75. 750 ;
  76. 760 .bas
  77. 770 sys"enter"rem graphic printer v2.01
  78. 780 end
  79. 790 ;
  80. 800 ;--------------------------------
  81. 810 ;
  82. 820 enter lda #>ml ;high byte load addr
  83. 830 sta $60
  84. 840 lda #<ml ;low byte load addr
  85. 850 sta $5f
  86. 860 lda #>last-$8000+ml ;high limit
  87. 870 sta $5b
  88. 880 lda #<last-$8000+ml ;high limit
  89. 890 sta $5a
  90. 900 lda #<last ;target address hi limit
  91. 910 sta $58
  92. 920 lda #>last ;target address hi limit
  93. 930 sta $59
  94. 940 jsr moveit ;(NULL) the code up!!!
  95. 950 jmp cold ;enter the (NULL)ed up code
  96. 960 ;
  97. 970 ml = *;
  98. 980 ;
  99. 990 ; note the assembler will pad the
  100. 1000 ; object file with junk from here
  101. 1010 ; to the m/l @ $8000!!!
  102. 1020 ;
  103. 1030 ;
  104. 1040 *= $8000 ; new code @ $8000
  105. 1050 ;
  106. 1060 ;
  107. 1070 cold lda #$40
  108. 1080  jsr setmsg ;turn on contorl messages
  109. 1090  lda #$80 
  110. 1100  sta msgflg ;flag $80 = direct mode
  111. 1110  lda #$00
  112. 1120  sta border
  113. 1130  sta bkgrnd ;screen & border to black
  114. 1140  lda #$93
  115. 1150  jsr chrout ;clear the screen
  116. 1160  jsr prmsg01 ;<position paper mess>
  117. 1170  lda #$64
  118. 1180  sta lstx ;set last key to $64=no key
  119. 1190 wait lda lstx
  120. 1200  cmp #$01
  121. 1210  bne wait ;wait until user presses a key
  122. 1220  lda #$00
  123. 1230  jsr setnam ;no name
  124. 1240  lda #$04
  125. 1250  ldx #$04
  126. 1260  ldy #25 ;printer interface initilization 4,4,25
  127. 1270  jsr setlfs
  128. 1280  jsr open ;open lfn #4
  129. 1290  ldx #$04
  130. 1300  jsr chkout ;set lfn #4 to output
  131. 1310  lda #$00
  132. 1320  jsr chrout ;output a null <lock interface>
  133. 1330  jsr clall  ;close all files
  134. 1340  jsr fill1  ;fill graphic file area $2000-$4800
  135. 1350  lda #10 
  136. 1360  sta lpcnt01 ;set loop counter to 10
  137. 1370  lda #$93
  138. 1380  jsr chrout ;clear the screen
  139. 1390  jsr dirload ;load directory @ $0801 on up
  140. 1400  lda #$08
  141. 1410  sta xchglo
  142. 1420  sta xchghi ;indirection ($0808)
  143. 1430  lda #11
  144. 1440  sta rowcnt ;11 rows per page
  145. 1450  jsr nameid ;process disk directory name and id
  146. 1460  jsr prnameid ;printout the disk name and id
  147. 1470 br02 jsr fill3 ;fill 1c00-1cff <file name buffer>
  148. 1480  lda #$00
  149. 1490  sta fretop
  150. 1500  lda #$1c
  151. 1510  sta fretop+1 ;strings to --$1c00=<protect buff>
  152. 1520  pha
  153. 1530  lda #$93
  154. 1540  jsr chrout ;clear the screen
  155. 1550  pla
  156. 1560  jsr loadem ;load 10 graphics <$2000-$4800>
  157. 1570  sta lpcnt01 ;# of graphics loaded a-reg
  158. 1580  cmp #$00 ;exit if no graphics were loaded
  159. 1590  beq br04 ;branch and exit
  160. 1600  lda #$20
  161. 1610  sta indhi01
  162. 1620  lda #$00
  163. 1630  sta indlo01 ;set to $2000 start of files in ram
  164. 1640  sta flag01  ;flag 0=normal $ff=<and $f0>/print
  165. 1650  jsr process ;
  166. 1660  jsr process ;
  167. 1670  jsr process ;process graphic into printer buffer
  168. 1680  jsr process ;6 normal passes
  169. 1690  jsr process ;
  170. 1700  jsr process ;
  171. 1710  lda #$ff ;set flag for and with $f0
  172. 1720  sta flag01 ;set the flag
  173. 1730  jsr process ;process 7th row <and -w- $f0>
  174. 1740  jsr prnames ;print graphic names under graphics
  175. 1750  dec rowcnt ;counter for next page title
  176. 1760  bne br03 ;if not zero contine with curr page
  177. 1770  jsr formfeed ;leave some space between rows
  178. 1780  jsr prnameid ;label next page of graphics
  179. 1790  lda #11 ;11 rows/page
  180. 1800  sta rowcnt ;reset counter
  181. 1810 br03 lda lpcnt01
  182. 1820  cmp #10 ;check the loop counter
  183. 1830  beq br02
  184. 1840 br04 jsr formfeed ;formfeed and exit!!!
  185. 1850  jsr clall ;close all files
  186. 1860 jmp cold ;(NULL) it again sam!!! was (rts)
  187. 1870 ;
  188. 1880 ;---------------------------------
  189. 1890 ;
  190. 1900 process = * ;
  191. 1910  jsr prmsg03 ;print thinking message
  192. 1920  jsr fill2 ;fill $5000-$53ff printer buffer
  193. 1930  lda #$00
  194. 1940  sta usr03 ;set the low byte $00
  195. 1950  lda #$50
  196. 1960  sta usr04 ;high byte $50 <$5000 graphic buffer>
  197. 1970  ldx #$00
  198. 1980 br05 lda indlo01
  199. 1990  sta usr01 ;set the low byte $00
  200. 2000  lda indhi01 
  201. 2010  sta usr02 ;high byte $20 <$2000 ram file storage>
  202. 2020  jsr process1 ;
  203. 2030  lda #8
  204. 2040  clc
  205. 2050  adc usr03 ;add 8 to buffer indirection <lo>
  206. 2060  sta usr03 ;store the new value
  207. 2070  bcc br06  ;test to see if inc. <hi>
  208. 2080  inc usr04 ;inc. <hi>
  209. 2090 br06 lda #4
  210. 2100  clc
  211. 2110  adc indhi01 ;inc. hi byte by 4 pages $2000
  212. 2120  sta indhi01 ;store the new value
  213. 2130  inx ;incrament the loop counter
  214. 2140  cpx #10 ;test the loop counter
  215. 2150  bne br05
  216. 2160  lda indlo01 ;subtract 168
  217. 2170  sec ;set the carry
  218. 2180  sbc #168
  219. 2190  sta indlo01 ;store the new value
  220. 2200  bcs br07
  221. 2210  dec indhi01 ;dec. the hi byte
  222. 2220 br07 lda indhi01
  223. 2230  sec ;set the carry
  224. 2240  sbc #39 ;subtract 39 <hi byte>
  225. 2250  sta indhi01 ;stroe the new value
  226. 2260  lda flag01 ;flag=0 skip and $f0 routine
  227. 2270  beq br09 ;branch around and routine if normal
  228. 2280  lda usr01
  229. 2290  pha ;save $fb on stack
  230. 2300  lda usr02
  231. 2310  pha ;save $fc on stack
  232. 2320  ldy #$00
  233. 2330  tya
  234. 2340  sta usr01 ;set low byte to $00
  235. 2350  lda #$50
  236. 2360  sta usr02 ;set high byte to $50 <$5000>
  237. 2370  ldx #$04 ;set loop counter
  238. 2380 br08 lda (usr01),y
  239. 2390  and #%11110000
  240. 2400  sta (usr01),y ;and off low nibble
  241. 2410  iny
  242. 2420  bne br08 ;loop
  243. 2430  inc usr02 ;incrament high byte of indirection
  244. 2440  dex ;decrament loop counter
  245. 2450  bne br08 ;test loop counter/loop until done
  246. 2460  pla
  247. 2470  sta usr02 ;restore $fc
  248. 2480  pla
  249. 2490  sta usr01 ;restore $fb
  250. 2500  lda #$00
  251. 2510  sta flag01 ;reset the flag to 0 normal print
  252. 2520 br09 jsr prmsg02 ;waiting for printer message
  253. 2530  ldx #$50 ;high byte
  254. 2540  ldy #$00 ;low byte
  255. 2550  jsr prgraph ;print the graphic buffer index x,y
  256. 2560  rts ;return to mainline
  257. 2570 ;
  258. 2580 ;---------------------------------
  259. 2590 ;
  260. 2600 loadem = * ;
  261. 2610  jsr fill1 ;fill graphic area $2000-$47ff with 0's
  262. 2620  lda #$00
  263. 2630  sta graphics ;reset the # of graphics loaded
  264. 2640  sta tape1 ;set load address low byte
  265. 2650  lda #$20
  266. 2660  sta tape1+1 ;set hi byte load address
  267. 2670 loop01 jsr search ;search for next name
  268. 2680  bne br10
  269. 2690  lda graphics ;a-reg = # loaded
  270. 2700  rts
  271. 2710 ;
  272. 2720 br10 jsr fileload ;load the graphic
  273. 2730  bcs loop01
  274. 2740  ldx #$00 ;zero the index
  275. 2750  ldy #$00 ;zero length
  276. 2760 loop02 lda namebuff,x ;load the current name
  277. 2770  cmp #$22 ;scan for a qutoe mark
  278. 2780  beq br11 ;branch if quote found
  279. 2790  sta (fretop),y ;xfer name into name string
  280. 2800  iny ;inc length
  281. 2810  inx ;inc index
  282. 2820  jmp loop02 ;loop around
  283. 2830 ;
  284. 2840 br11 inc graphics ;inc. # of files loaded
  285. 2850  lda graphics ;load # of files loaded
  286. 2860  tax ;x-reg # of files loaded
  287. 2870  lda index,x ;index byte to position name's
  288. 2880  sta fretop
  289. 2890  lda #10 ;setup test for 10 files
  290. 2900  cmp graphics ;test